package com.tbit.uqbike.object.value;

import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @author jing
 * @date 2020/11/914:14
 * @Description:
 */
@Data
@NoArgsConstructor
public class Page<T> implements Serializable {
    private static final long serialVersionUID = 23543576568L;
    private Integer pageNO;
    private Integer rowCount;
    private Integer pageCount;
    private Long recordCount;

    public Page(PageInfo<T> pageInfo) {
        this.pageNO = pageInfo.getPageNum();
        this.rowCount = pageInfo.getPageSize();
        this.pageCount = pageInfo.getPages();
        this.recordCount = pageInfo.getTotal();
    }

    public Page(Integer pageNO, Integer rowCount) {
        this.pageNO = pageNO;
        this.rowCount = rowCount;
    }

    public Page(List<T> list) {
        this(new PageInfo(list));
    }

}
